/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.coverage_measuring.mutator;

import java.util.HashSet;
import java.util.Set;

class AggregateCoverageListener implements CoverageListener {
	private final Set<CoverageListener> coverageListeners = new HashSet<CoverageListener>();

	public void add(CoverageListener coverageListener) {
		coverageListeners.add(coverageListener);
	}

	///////////////////////////////////////////////////////////////////////////////////////////////
	// CoverageListener methods
	///////////////////////////////////////////////////////////////////////////////////////////////

	public void covered(int coverageId) {
		for (CoverageListener coverageListener : coverageListeners) {
			if (coverageListener != null) {
				coverageListener.covered(coverageId);
			}
		}
	}
}
